package com.encryption.feature.doc
{
	import com.encryption.framework.constant.DocTypeConstant;
	import com.encryption.framework.constant.ResourceConstant;

	public class DocTypeManager
	{
		private static var _instance:DocTypeManager = new DocTypeManager();
		
		public function DocTypeManager()
		{
		}
		
		public static function get instance():DocTypeManager
		{
			return _instance;
		}
		
		public function getTypeImage(type:String):Class{
			if(type == DocTypeConstant.TYPE_WORD)
				return ResourceConstant.ICON_FILE_WORD;
			if(type == DocTypeConstant.TYPE_PPT)
				return ResourceConstant.ICON_FILE_PPT;
			if(type == DocTypeConstant.TYPE_PDF)
				return ResourceConstant.ICON_FILE_PDF;
			if(type == DocTypeConstant.TYPE_EXCEL)
				return ResourceConstant.ICON_FILE_EXCEL;
			
			return ResourceConstant.ICON_FILE_WORD;
		}
		
		public function getType(suffix:String):String
		{
			if(suffix == "doc" || suffix == "docx")
				return DocTypeConstant.TYPE_WORD;
			else if(suffix == "ppt" || suffix == "pptx")
				return DocTypeConstant.TYPE_PPT;
			else if(suffix == "xls" || suffix == "xlsx")
				return DocTypeConstant.TYPE_EXCEL;
			else if(suffix == "pdf")
				return DocTypeConstant.TYPE_PDF;
			
			return DocTypeConstant.TYPE_WORD;
			
		}
		
	}
}